package com.emmmya.ocs.modules.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.emmmya.ocs.common.utils.ResultUtil;
import com.emmmya.ocs.common.vo.Result;
import com.emmmya.ocs.modules.system.entity.SysLog;
import com.emmmya.ocs.modules.system.service.SysLogService;
import com.emmmya.ocs.modules.system.vo.SysLogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @description:
 * @author: 咕噜肉IT小店-黑医
 * @createDate: 2020-12-19
 * @version: 1.0
 */
@Controller
@RequestMapping("system")
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;


    @RequestMapping("sysLog")
    public String sysLog(){
        return "admin2/system/sys-log";
    }

    /**
     *
     * @param vo
     * @return
     */
    @GetMapping("getSysLogList")
    @ResponseBody
    //@ApiOperation(value="获取系统日志",httpMethod = "GET",response = Result.class)
    //@ApiImplicitParams(@ApiImplicitParam(name = "queryVo",value="查询条件",required = true,paramType="SysLogVo"))
    public Result<Object> getSysLogList(SysLogVo vo){
        try {
            IPage<SysLog> page = vo.createPage();
            sysLogService.getListByPage(page, vo.createWrapper());
            return ResultUtil.data(page);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.error("系统错误，请先联系系统管理员！错误信息:"+e.getMessage());
        }
    }


}
